﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace _3.WcfServiceLibraryStrings
{    
    public class ServiceStrings : IServiceStrings
    {
        public int NumberOfTimes(string content, string search)
        {
            int numberOfTimes = 0;
            int startIndex = -1;

            while (true)
            {
                startIndex = content.IndexOf(search, startIndex + 1);
                if (startIndex >= 0)
                {
                    numberOfTimes++;
                }
                else
                {
                    break;
                }
            }
            return numberOfTimes;
        }
    }
}
